package com.xzit.aop.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

import java.util.Arrays;
import java.util.List;

@Configuration
@PropertySource(value = "classpath:risk.properties", encoding = "UTF-8")
public class RiskAreaConfig {

    @Value("${high.risk.areas}")
    private String highRiskAreas;

    public List<String> getHighRiskAreas() {
        return Arrays.asList(highRiskAreas.split(","));
    }

    public boolean isRiskArea(String area) {
        return getHighRiskAreas().contains(area);
    }
}
